package com.polylink.sys.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;

import com.mapper.SqlMapper;
import com.polylink.base.Page;
import com.polylink.sys.bean.Model;
import com.polylink.sys.dao.sqlProvider.ModelSqlProvider;

/**
 *@author xiliang.xiao
 *@date 2015年3月23日 上午9:03:57
 *
 **/
public interface IModelDao extends SqlMapper{

	@Insert("Insert into cti_web_model (name,remark,parent_id) "
			+ "value(#{name},#{remark} ,#{parentId})")
	public int add(Model model);

	@SelectProvider(type=ModelSqlProvider.class,method="list")
	public abstract List<Model> list(Page p) ;

	@SelectProvider(type=ModelSqlProvider.class,method="count")
	public int count(Page p);

	@Update("update cti_web_model set name=#{name},remark=#{remark},parent_id=#{parentId} where id=#{id}")
	public int update(Model model);

	@Delete("delete from cti_web_model where id in (${id})")
	public int delete(@Param("id")String id);

	@Select("select u.id id,u.name name,u.remark remark,u.parent_id parentId from cti_web_model u")
	public List<Model> select();

}
